﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CourseSystem.Core.Entities.QuestionLibInfo>" %>
<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<% using (Ajax.BeginForm("LibEditUc", new { Model.Id }, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "editDiv", OnSuccess = "jump2Edit" }))
   {%>
<% Html.RenderPartial("HighLightMsgUc"); %>
<fieldset>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.Title) %>
    </div>
    <div class="editor-field">
        <%: Html.TextBoxFor(model => model.Title,new{@class="longText"}) %>
        <%: Html.ValidationMessageFor(model => model.Title) %>
    </div>
    <% if(Model.Id==0){ %>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.Type) %>
    </div>
    <div class="editor-field">
        <select name="Type" id="Type">
            <option value="0">单选题</option>
            <option value="1">多选题</option>
            <option value="2">判断题</option>
            <option value="3">论述题</option>
            <option value="4">思考题</option>
        </select>
        <%: Html.ValidationMessageFor(model => model.Type) %>
    </div>
    
    <div class="editor-label">
        章
    </div>
    <div class="editor-field">
        <%=Html.DropDownList("ChapterIdFake", ChapterHelper.GetChapter(), new { onchange = "chapterChange();" })%>
        <%: Html.ValidationMessage("ChapterIdFake")%>
    </div>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.SectionId) %>
    </div>
    <div class="editor-field">
        <%=Html.DropDownList("SectionId", SectionHelper.GetSection(Model.ChapterIdFake))%>
        <%: Html.ValidationMessageFor(model => model.SectionId) %>
    </div>

    <%} %>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.Score) %>
    </div>
    <div class="editor-field">
        <%=Html.TextBoxFor(model => model.Score) %>
        <%: Html.ValidationMessageFor(model => model.Score)%>
    </div>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.DiffCoe) %>
    </div>
    <div class="editor-field">
        <%=Html.TextBoxFor(model => model.DiffCoe) %>
        <%: Html.ValidationMessageFor(model => model.DiffCoe)%>
    </div>
    <%=Html.Hidden("jump",ViewData["jump"],new{id="jump"}) %>
    <p>
        <input type="submit" value="保存" />
    </p>
</fieldset>
<% } %>
<script type="text/javascript">
    var chapterChange = function () {
        selectLoad("SectionId", "Ajax/GetSection/" + $("#ChapterIdFake").val());
    };

</script>